﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
using You2V.Data.Shared;
using You2V.LocalDBLayer;

namespace You2VTool.Controls
{
    /// <summary>
    /// Interaction logic for StudentHistory.xaml
    /// </summary>
    public partial class StudentHistory : UserControl
    {
        //todo，本窗口显示同一个学生不同学期的资助历史，类似于以前的跟踪表，每学期占一行
        public StudentHistory()
        {
            InitializeComponent();
            formatGrid();
        }

        private void formatGrid()
        {

            DataGridTextColumn PeriodColumn = new DataGridTextColumn();
            PeriodColumn.Header = "受助学期";

            //Binding binding = new Binding(p_r.ColumnName);
            //PeriodColumn.Binding = binding;
            dg_report.Columns.Add(PeriodColumn);

            DataTable _resource = StudentPeriodCollection.GetPeriodTable();
            foreach (DataColumn p_r in _resource.Columns)
            {
                if (p_r.ColumnName != "periodActionSummary")
                {
                    DataGridTextColumn p_column = new DataGridTextColumn();
                    p_column.Header = p_r.ColumnName;
                    //p_column.MinWidth = 60;

                    Binding binding = new Binding(p_r.ColumnName);
                    p_column.Binding = binding;
                    dg_report.Columns.Add(p_column);
                }
            }
        }
    }
}
